package com.kaibes.orm.curd;

import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

@SuppressWarnings("serial")
public class Query implements Serializable, Comparable<Query> {

    private HashMap<String, Object> eq;
    private HashMap<String, Object> ne;
    private HashMap<String, Object> lt;
    private HashMap<String, Object> gt;
    private HashMap<String, Object> lte;
    private HashMap<String, Object> gte;
    
    private HashMap<String, Object> like;
    private HashMap<String, Object> notLike;
    
    private HashMap<String, Object[]> in;
    private HashMap<String, Object[]> notIn;
    
    private HashMap<String, Select> eqSelect;
    private HashMap<String, Select> neSelect;
    private HashMap<String, Select> inSelect;
    private HashMap<String, Select> notInSelect;
    
    private List<String> nullValue;
    private List<String> notNullValue;
    private List<String> sqlList;
    private List<String> todayList;
    
    public HashMap<String, Object> getEq() {
        return eq;
    }
    public void setEq(HashMap<String, Object> eq) {
        this.eq = eq;
    }
    public HashMap<String, Object> getNe() {
        return ne;
    }
    public void setNe(HashMap<String, Object> ne) {
        this.ne = ne;
    }
    public HashMap<String, Object> getLt() {
        return lt;
    }
    public void setLt(HashMap<String, Object> lt) {
        this.lt = lt;
    }
    public HashMap<String, Object> getGt() {
        return gt;
    }
    public void setGt(HashMap<String, Object> gt) {
        this.gt = gt;
    }
    public HashMap<String, Object> getLte() {
		return lte;
	}
    public void setLte(HashMap<String, Object> lte) {
		this.lte = lte;
	}
    public HashMap<String, Object> getGte() {
		return gte;
	}
    public void setGte(HashMap<String, Object> gte) {
		this.gte = gte;
	}
    public HashMap<String, Object> getLike() {
        return like;
    }
    public void setLike(HashMap<String, Object> like) {
        this.like = like;
    }
    public HashMap<String, Object> getNotLike() {
        return notLike;
    }
    public void setNotLike(HashMap<String, Object> notLike) {
        this.notLike = notLike;
    }
    public List<String> getNullValue() {
        return nullValue;
    }
    public void setNullValue(List<String> nullValue) {
        this.nullValue = nullValue;
    }
    public List<String> getNotNullValue() {
        return notNullValue;
    }
    public void setNotNullValue(List<String> notNullValue) {
        this.notNullValue = notNullValue;
    }
    public HashMap<String, Object[]> getIn() {
        return in;
    }
    public void setIn(HashMap<String, Object[]> in) {
        this.in = in;
    }
    public HashMap<String, Object[]> getNotIn() {
        return notIn;
    }
    public void setNotIn(HashMap<String, Object[]> notIn) {
        this.notIn = notIn;
    }
    public HashMap<String, Select> getEqSelect() {
        return eqSelect;
    }
    public void setEqSelect(HashMap<String, Select> eqSelect) {
        this.eqSelect = eqSelect;
    }
    public HashMap<String, Select> getInSelect() {
        return inSelect;
    }
    public void setInSelect(HashMap<String, Select> inSelect) {
        this.inSelect = inSelect;
    }
    public HashMap<String, Select> getNeSelect() {
        return neSelect;
    }
    public void setNeSelect(HashMap<String, Select> neSelect) {
        this.neSelect = neSelect;
    }
    public HashMap<String, Select> getNotInSelect() {
        return notInSelect;
    }
    public void setNotInSelect(HashMap<String, Select> notInSelect) {
        this.notInSelect = notInSelect;
    }
    public List<String> getSqlList() {
        return sqlList;
    }
    public void setSqlList(List<String> sqlList) {
        this.sqlList = sqlList;
    }
    public List<String> getTodayList() {
        return todayList;
    }
    public void setTodayList(List<String> todayList) {
        this.todayList = todayList;
    }
    
    @Override
    public String toString() {
        if (nullValue != null) {
            Collections.sort(nullValue);
        }
        if (notNullValue != null) {
            Collections.sort(notNullValue);
        }
        if (sqlList != null) {
            Collections.sort(sqlList);
        }
        if (todayList != null) {
            Collections.sort(todayList);
        }
        return "Query [eq=" + eq + ", ne=" + ne + ", lt=" + lt + ", gt=" + gt + ", lte=" + lte + ", gte=" + gte + ", like=" + like + ", notLike="
                + notLike + ", nullValue=" + nullValue + ", notNullValue=" + notNullValue + ", sqlList=" + sqlList + ", todayList=" + todayList + ", in=" + in + ", notIn="
                + notIn + ", eqSelect=" + eqSelect + ", neSelect=" + neSelect + ", inSelect=" + inSelect + ", notInSelect=" + notInSelect + "]";
    }
    
    @Override
    public int compareTo(Query o) {
        return toString().compareTo(o.toString());
    }
    
}
